package com.ysd.lis.controller.lab;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabReqUnqualified;
import com.ysd.lis.entity.lab.LabReqUnqualifiedDetail;
import com.ysd.lis.service.lab.LabReqUnqualifiedDetailService;
import com.ysd.lis.service.lab.LabReqUnqualifiedService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 不合格记录原因详情表 前端控制器
 * </p>
 *
 * @author Bai
 * @since 2024-02-04
 */
@RestController
@RequestMapping("/lab/req/unqualified/detail")
public class LabReqUnqualifiedDetailController extends BaseController {

    @Autowired
    LabReqUnqualifiedDetailService reqUnqualifiedDetailService;

    @ApiOperation("保存不合格标本处理原因")
    @PostMapping("/saveDetail")
    public Result saveDetail(@RequestBody LabReqUnqualified labReqUnqualified) throws JsonProcessingException {
        return reqUnqualifiedDetailService.saveDetail(labReqUnqualified);
    }

    @ApiOperation("保存不合格标本处理原因(不合格标本)")
    @PostMapping("/saveDetailByMain")
    public Result saveDetailByMain(@RequestBody LabReqUnqualifiedDetail reqUnqualifiedDetail) {
        return reqUnqualifiedDetailService.saveDetailByMain(reqUnqualifiedDetail);
    }

    @ApiOperation("获取不合格标本处理原因")
    @GetMapping("/getDetailList")
    public Result getDetailList( LabReqUnqualifiedDetail reqUnqualifiedDetail) {
        return reqUnqualifiedDetailService.getDetailList(reqUnqualifiedDetail);
    }
}
